package br.com.djiadreams.basededados;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class BDOpenHelper extends SQLiteOpenHelper {

	public static final String TABLE_INFOS = "infos";
	public static final String SINAL = "sinal";
	public static final String LATITUDE = "latitude";
	public static final String LONGITUDE = "longitude";
	public static final String OPERADORA = "operadora";

	private static final String DATABASE_NAME = "georeferenced.db";
	private static final int DATABASE_VERSION = 1;

	public static final String DATABASE_CREATE = "create table " + TABLE_INFOS
			+ "(" + OPERADORA + " varchar(10) not null, " + SINAL
			+ " integer not null, " + LATITUDE + " double not null, "
			+ LONGITUDE + " double not null);";

	public BDOpenHelper(Context c) {
		super(c, DATABASE_NAME, null, DATABASE_VERSION);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		// TODO Auto-generated method stub
		db.execSQL(DATABASE_CREATE);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// TODO Auto-generated method stub
		db.execSQL("DROP IF EXISTS " + TABLE_INFOS);
		onCreate(db);
	}

}
